package net.hserver.custom.server.handler;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import net.hserver.custom.protocol.SmartCarProtocol;

public class SmartCarHandler extends SimpleChannelInboundHandler<SmartCarProtocol> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, SmartCarProtocol msg) throws Exception {
        System.out.println("Server接受的客户端的信息 :" + msg.toString());
        String str="服务端发送时间："+System.currentTimeMillis();
        SmartCarProtocol response = new SmartCarProtocol(str.getBytes().length, str.getBytes());
        ctx.writeAndFlush(response);
    }
}
